




#ifndef MPU_I2C_H
#define MPU_I2C_H

#include <stdio.h>
#include <unistd.h>
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "iot_errno.h" //==IOT_SUCCESS =0 

#include "hi_io.h"   //上拉、复用
#include "hi_gpio.h" //hi_gpio_set_dir()、hi_gpio_set(get)_output(input)_val()

#define MPU_SDA_IO11  11
#define MPU_SCL_IO10  10  




#endif

/**
 * 
 * Soft iic code 2021.09.04 By HelloKun
 * 
#ifndef MPU_I2C_H
#define MPU_I2C_H

#include <stdio.h>
#include <unistd.h>
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "iot_errno.h" //==IOT_SUCCESS =0 

#include "hi_io.h"   //上拉、复用
#include "hi_gpio.h" //hi_gpio_set_dir()、hi_gpio_set(get)_output(input)_val()

#define MPU_SDA_IO11  11
#define MPU_SCL_IO10  10  

//SDA-I\O
#define MPU_SDA_IN()  {hi_io_set_pull(11,HI_IO_PULL_UP);hi_gpio_set_dir(11,0);} //io11 SDA-pull_int
#define MPU_SDA_OUT() {hi_gpio_set_dir(11,1);} //io11 SDA-out

//SCL\SDA OUT 0-1
#define MPU_IIC_SCL_OUT_1()    hi_gpio_set_ouput_val(10,1) //SCL out-1
#define MPU_IIC_SCL_OUT_0()    hi_gpio_set_ouput_val(10,0) //SCL out-0
#define MPU_IIC_SDA_OUT_1()    {hi_io_set_pull(11,HI_IO_PULL_UP);hi_gpio_set_ouput_val(11,1);}  //SDA-out 1
#define MPU_IIC_SDA_OUT_0()    {hi_io_set_pull(11,HI_IO_PULL_UP);hi_gpio_set_ouput_val(11,0);}  //SDA-out 0
//SDA INT 
#define MPU_READ_SDA   hi_gpio_get_input_val(11,&val)  //SDA-int


void MPU_IIC_Init(void);                			 
void MPU_IIC_Start(void);				
void MPU_IIC_Stop(void);	  			
void MPU_IIC_Send_Byte(uint8_t txd);			
uint8_t MPU_IIC_Read_Byte(unsigned char ack);
uint8_t MPU_IIC_Wait_Ack(void); 				
void MPU_IIC_Ack(void);					
void MPU_IIC_NAck(void);				

#endif


*/